package top.tony.employee.query;

import org.springframework.util.StringUtils;
import top.tony.base.pagenation.BaseQueryObject;
import top.tony.base.pagenation.ConditionHandler;

/**
 * Created by Tony_Du on 2015/12/3 0003.
 */
public class EmployeeVoQueryObject extends BaseQueryObject {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Override
    protected void buildSql() {
        selectSql.append("SELECT id,c_name AS myname FROM t_employee");
        countSql.append("SELECT COUNT(id) FROM t_employee");
        ConditionHandler conditionHandler=new ConditionHandler();

        if(StringUtils.hasText(name)){
            param.put("name","%"+name+"%");
            conditionHandler.append("c_name LIKE :name", selectSql, countSql);
        }
    }
}
